﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string username = (string)Session["name"];

                TextBox1.Text = username;

            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string username = (string)Session["name"];
            string passward = (string)Session["pass"];
            if (username == TextBox1.Text && passward == TextBox2.Text)
            {
                Session.Add("name", TextBox1.Text);
                Label1.Text = "账号密码正确    <a href=\"WebForm3.aspx\">登录</a>";
            }
            else
            {
                Label1.Text = "密码或者账号错误！";
            }
        }
    }
}